package com.yunji.common.model.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yunji.common.utils.bean.BeanUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.Map;

@Data
public class NoticeVO {

   @ApiModelProperty("消息ID")
   private Long noticeId;
   @ApiModelProperty("通知类型 0-公告 1-通知")
   private String messageType;
   @ApiModelProperty("消息类型 0-补货 1-售卖 2-改价 3-预警")
   private Integer noticeType;
   @ApiModelProperty("通知内容")
   private String noticeContent;
   @ApiModelProperty("通知标题")
   private String noticeTitle;
   @ApiModelProperty("消息内容json格式")
   private String jsonContent;
   @ApiModelProperty("消息内容map格式")
   private Map<String, Object> content;
   @ApiModelProperty("创建时间")
   @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
   private Date createTime;

   public String getNoticeContent() {
      return BeanUtils.isNotNull(this.content) ? this.content.get("noticeContent").toString() : null;
   }
}
